class_name Entity_AdditionalEffect_ChangeHealth
extends Entity_AdditionalEffect

#region 属性
@export var change_value:float
@export var can_counter:bool
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
func add_effect(provider,target):
	var component = target.get_component_by_name("HealthComponent")
	var data = target.get_entity_data()
	var source_entity = data.source_entity if "source_entity" in data and data.source_entity else provider
	if component and data:
		component = component as HealthComponent
		if change_value >= 0:
			component.recover(data.get_temp_data(source_entity,provider,change_value))
		else:
			component.hit(data.get_temp_data(source_entity,provider,change_value))
		var slot_component = target.get_component_by_name("SlotComponent") as SlotComponent
		GameUISystem.popup_text(slot_component.get_slot_by_type(GameEnum.SlotType.Head).global_position,abs(change_value))

func remove_effect(provider,target):
	pass
#endregion
#region 公共方法
#endregion
#region 私有方法
#endregion
#region 生命周期函数
#endregion
